package com.example.leidong.ldmart.greendao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.example.leidong.ldmart.beans.Buyer;
import com.example.leidong.ldmart.beans.Order;
import com.example.leidong.ldmart.beans.Product;
import com.example.leidong.ldmart.beans.Root;
import com.example.leidong.ldmart.beans.Seller;

import com.example.leidong.ldmart.greendao.BuyerDao;
import com.example.leidong.ldmart.greendao.OrderDao;
import com.example.leidong.ldmart.greendao.ProductDao;
import com.example.leidong.ldmart.greendao.RootDao;
import com.example.leidong.ldmart.greendao.SellerDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig buyerDaoConfig;
    private final DaoConfig orderDaoConfig;
    private final DaoConfig productDaoConfig;
    private final DaoConfig rootDaoConfig;
    private final DaoConfig sellerDaoConfig;

    private final BuyerDao buyerDao;
    private final OrderDao orderDao;
    private final ProductDao productDao;
    private final RootDao rootDao;
    private final SellerDao sellerDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        buyerDaoConfig = daoConfigMap.get(BuyerDao.class).clone();
        buyerDaoConfig.initIdentityScope(type);

        orderDaoConfig = daoConfigMap.get(OrderDao.class).clone();
        orderDaoConfig.initIdentityScope(type);

        productDaoConfig = daoConfigMap.get(ProductDao.class).clone();
        productDaoConfig.initIdentityScope(type);

        rootDaoConfig = daoConfigMap.get(RootDao.class).clone();
        rootDaoConfig.initIdentityScope(type);

        sellerDaoConfig = daoConfigMap.get(SellerDao.class).clone();
        sellerDaoConfig.initIdentityScope(type);

        buyerDao = new BuyerDao(buyerDaoConfig, this);
        orderDao = new OrderDao(orderDaoConfig, this);
        productDao = new ProductDao(productDaoConfig, this);
        rootDao = new RootDao(rootDaoConfig, this);
        sellerDao = new SellerDao(sellerDaoConfig, this);

        registerDao(Buyer.class, buyerDao);
        registerDao(Order.class, orderDao);
        registerDao(Product.class, productDao);
        registerDao(Root.class, rootDao);
        registerDao(Seller.class, sellerDao);
    }
    
    public void clear() {
        buyerDaoConfig.getIdentityScope().clear();
        orderDaoConfig.getIdentityScope().clear();
        productDaoConfig.getIdentityScope().clear();
        rootDaoConfig.getIdentityScope().clear();
        sellerDaoConfig.getIdentityScope().clear();
    }

    public BuyerDao getBuyerDao() {
        return buyerDao;
    }

    public OrderDao getOrderDao() {
        return orderDao;
    }

    public ProductDao getProductDao() {
        return productDao;
    }

    public RootDao getRootDao() {
        return rootDao;
    }

    public SellerDao getSellerDao() {
        return sellerDao;
    }

}
